#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <string.h>
#include <stdio.h>

int main(){
  int fds[3];
  fds[0] = open("test1.txt", O_RDWR | O_CREAT, 0664);
  fds[1] = open("test2.txt", O_RDWR | O_CREAT, 0664);
  fds[2] = open("test3.txt", O_RDWR | O_CREAT, 0664);

  char buf[10] = {0};
  int i = 0;

  for(; i < 3; ++i){
    memset(buf, 0, 3);
    int ret = read(fds[i], buf, 3);
    if(ret < 0){
      perror("read");
    }
    printf("[%d]: %s\n", fds[i], buf);
  }

  return 0;
}
